package controllers;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import autoservice.api.messages.Messager;

class ClassParserObject {
	
	private static final String DELIMITER=" ";
	private static final String REGEX ="//";
	private static final String REPLACEMENT = "\\";
	private static SimpleDateFormat formatter = new SimpleDateFormat(Messager.DATE_FORMAT);
	private static String[] arr;
	
	
	static void setArray(String line){
		arr =line.split(DELIMITER);
		
	}
	
	
	static Date getDate(Integer indexArray) throws ParseException{	
			Date date = formatter.parse(arr[indexArray]);
			return date;		
	}
	
	

	static Integer getInt(Integer indexArray){
		Integer parameter=Integer.parseInt(arr[indexArray]);
		return parameter;
	}
	
	static String getString(Integer indexArray){
		return arr[indexArray];
	}
	
	static String replaceUrl(String url){
		url.replaceAll(REGEX, REPLACEMENT);
		return url;
	}
}
